package com.wenhai.easyexcel.listener;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.wenhai.easyexcel.entity.User;
import com.wenhai.easyexcel.mapper.UserMapper;

public class UserListener extends AnalysisEventListener<User> {

    private UserMapper userMapper;


    public UserListener(UserMapper userMapper) {
        this.userMapper = userMapper;
    }

    @Override
    public void invoke(User data, AnalysisContext context) {
        System.out.println(data);
        userMapper.save(data);
    }

    @Override
    public void doAfterAllAnalysed(AnalysisContext context) {

    }
}
